|
1
|
|
|
/** |
|
2
|
|
|
Copyright 2018 June Hanabi |
|
3
|
|
|
|
|
4
|
|
|
Licensed under the Apache License, Version 2.0 (the "License"); |
|
5
|
|
|
you may not use this file except in compliance with the License. |
|
6
|
|
|
You may obtain a copy of the License at |
|
7
|
|
|
|
|
8
|
|
|
http://www.apache.org/licenses/LICENSE-2.0 |
|
9
|
|
|
|
|
10
|
|
|
Unless required by applicable law or agreed to in writing, software |
|
11
|
|
|
distributed under the License is distributed on an "AS IS" BASIS, |
|
12
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13
|
|
|
See the License for the specific language governing permissions and |
|
14
|
|
|
limitations under the License. |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
import { Component } from '@angular/core'; |
|
18
|
|
|
import { SaveFileService } from "../../data/savefile.service"; |
|
19
|
|
|
|
|
20
|
|
|
@Component({ |
|
21
|
|
|
selector: 'screen-area-pokemon', |
|
22
|
|
|
templateUrl: './area-pokemon.component.pug', |
|
23
|
|
|
styleUrls: ['./area-pokemon.component.scss'], |
|
24
|
|
|
}) |
|
25
|
|
|
export class AreaPokemonComponent { |
|
26
|
|
|
|
|
27
|
|
|
constructor( |
|
28
|
|
|
public fileService: SaveFileService, |
|
29
|
|
|
) { } |
|
30
|
|
|
|
|
31
|
|
|
get grassEntries() { |
|
32
|
|
|
return this.fileService.fileDataExpanded.area.pokemon.grassPokemon; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
get waterEntries() { |
|
36
|
|
|
return this.fileService.fileDataExpanded.area.pokemon.waterPokemon; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
addGrassEntry() { |
|
40
|
|
|
this.fileService.fileDataExpanded.area.pokemon.grassPokemon.push({ |
|
41
|
|
|
level: 0, |
|
42
|
|
|
pokemon: 0, |
|
43
|
|
|
}); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
addWaterEntry() { |
|
47
|
|
|
this.fileService.fileDataExpanded.area.pokemon.waterPokemon.push({ |
|
48
|
|
|
level: 0, |
|
49
|
|
|
pokemon: 0, |
|
50
|
|
|
}); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
remGrassEntry(index: number) { |
|
54
|
|
|
this.fileService.fileDataExpanded.area.pokemon.grassPokemon.splice(index, 1); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
remWaterEntry(index: number) { |
|
58
|
|
|
this.fileService.fileDataExpanded.area.pokemon.grassPokemon.splice(index, 1); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
grassRateClick() { |
|
62
|
|
|
if (this.fileService.fileDataExpanded.area.pokemon.grassRate > 0) |
|
63
|
|
|
this.fileService.fileDataExpanded.area.pokemon.grassRate = 0; |
|
64
|
|
|
else |
|
65
|
|
|
this.fileService.fileDataExpanded.area.pokemon.grassRate = 1; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
waterRateClick() { |
|
69
|
|
|
if (this.fileService.fileDataExpanded.area.pokemon.waterPokemonRate > 0) |
|
70
|
|
|
this.fileService.fileDataExpanded.area.pokemon.waterPokemonRate = 0; |
|
71
|
|
|
else |
|
72
|
|
|
this.fileService.fileDataExpanded.area.pokemon.waterPokemonRate = 1; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
entriesTracking(index: number) { |
|
76
|
|
|
return index; // or item.id |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|